package com.lzz.service.imple;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lzz.dao.StudentDao;
import com.lzz.entity.Student;
import com.lzz.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhenzhen
 * @date 2018-12-18 下午11:47
 */
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentDao studentDao;

    @Override
    public int addStudent(Student student) {
        int result = studentDao.add(student);
        return result;
    }

    @Override
    public PageInfo<Student> getAllUser(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Student> students = studentDao.getAll();
        PageInfo result = new PageInfo(students);
        return result;
    }
}
